package com.kedsoft.docms.controller;

import com.kedsoft.docms.entity.User;
import org.springframework.web.bind.annotation.ModelAttribute;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Created by Administrator on 2018/11/9.
 */
public class BaseController {

    @ModelAttribute
    public final void init(HttpServletRequest request, HttpServletResponse response) throws Exception{
        User bean = (User) request.getSession().getAttribute("loginUser");
        if(bean == null){
            response.sendRedirect("/login.html");
            return;
        }
    }
}
